Integrand size = 21, antiderivative size = 101 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\frac {1}{8} \left (4 a^2+3 b^2\right ) x-\frac {2 a b \cos (e+f x)}{f}+\frac {2 a b \cos ^3(e+f x)}{3 f}-\frac {\left (4 a^2+3 b^2\right ) \cos (e+f x) \sin (e+f x)}{8 f}-\frac {b^2 \cos (e+f x) \sin ^3(e+f x)}{4 f} \]
1/8*(4*a^2+3*b^2)*x-2*a*b*cos(f*x+e)/f+2/3*a*b*cos(f*x+e)^3/f-1/8*(4*a^2+3 *b^2)*cos(f*x+e)*sin(f*x+e)/f-1/4*b^2*cos(f*x+e)*sin(f*x+e)^3/f
Time = 0.21 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.16 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\frac {a^2 (e+f x)}{2 f}+\frac {3 b^2 (e+f x)}{8 f}-\frac {3 a b \cos (e+f x)}{2 f}+\frac {a b \cos (3 (e+f x))}{6 f}-\frac {a^2 \sin (2 (e+f x))}{4 f}-\frac {b^2 \sin (2 (e+f x))}{4 f}+\frac {b^2 \sin (4 (e+f x))}{32 f} \]
(a^2*(e + f*x))/(2*f) + (3*b^2*(e + f*x))/(8*f) - (3*a*b*Cos[e + f*x])/(2* f) + (a*b*Cos[3*(e + f*x)])/(6*f) - (a^2*Sin[2*(e + f*x)])/(4*f) - (b^2*Si n[2*(e + f*x)])/(4*f) + (b^2*Sin[4*(e + f*x)])/(32*f)
Time = 0.43 (sec) , antiderivative size = 91, normalized size of antiderivative = 0.90, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {3042, 3268, 3042, 3113, 2009, 3493, 3042, 3115, 24}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \sin (e+f x)^2 (a+b \sin (e+f x))^2dx\) |
\(\Big \downarrow \) 3268 |
\(\displaystyle \int \sin ^2(e+f x) \left (a^2+b^2 \sin ^2(e+f x)\right )dx+2 a b \int \sin ^3(e+f x)dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \sin (e+f x)^2 \left (a^2+b^2 \sin (e+f x)^2\right )dx+2 a b \int \sin (e+f x)^3dx\) |
\(\Big \downarrow \) 3113 |
\(\displaystyle \int \sin (e+f x)^2 \left (a^2+b^2 \sin (e+f x)^2\right )dx-\frac {2 a b \int \left (1-\cos ^2(e+f x)\right )d\cos (e+f x)}{f}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \int \sin (e+f x)^2 \left (a^2+b^2 \sin (e+f x)^2\right )dx-\frac {2 a b \left (\cos (e+f x)-\frac {1}{3} \cos ^3(e+f x)\right )}{f}\) |
\(\Big \downarrow \) 3493 |
\(\displaystyle \frac {1}{4} \left (4 a^2+3 b^2\right ) \int \sin ^2(e+f x)dx-\frac {2 a b \left (\cos (e+f x)-\frac {1}{3} \cos ^3(e+f x)\right )}{f}-\frac {b^2 \sin ^3(e+f x) \cos (e+f x)}{4 f}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{4} \left (4 a^2+3 b^2\right ) \int \sin (e+f x)^2dx-\frac {2 a b \left (\cos (e+f x)-\frac {1}{3} \cos ^3(e+f x)\right )}{f}-\frac {b^2 \sin ^3(e+f x) \cos (e+f x)}{4 f}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {1}{4} \left (4 a^2+3 b^2\right ) \left (\frac {\int 1dx}{2}-\frac {\sin (e+f x) \cos (e+f x)}{2 f}\right )-\frac {2 a b \left (\cos (e+f x)-\frac {1}{3} \cos ^3(e+f x)\right )}{f}-\frac {b^2 \sin ^3(e+f x) \cos (e+f x)}{4 f}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {1}{4} \left (4 a^2+3 b^2\right ) \left (\frac {x}{2}-\frac {\sin (e+f x) \cos (e+f x)}{2 f}\right )-\frac {2 a b \left (\cos (e+f x)-\frac {1}{3} \cos ^3(e+f x)\right )}{f}-\frac {b^2 \sin ^3(e+f x) \cos (e+f x)}{4 f}\) |
(-2*a*b*(Cos[e + f*x] - Cos[e + f*x]^3/3))/f - (b^2*Cos[e + f*x]*Sin[e + f *x]^3)/(4*f) + ((4*a^2 + 3*b^2)*(x/2 - (Cos[e + f*x]*Sin[e + f*x])/(2*f))) /4
3.2.58.3.1 Defintions of rubi rules used
Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1) Subst[Int[Exp and[(1 - x^2)^((n - 1)/2), x], x], x, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x _)])^2, x_Symbol] :> Simp[2*c*(d/b) Int[(b*Sin[e + f*x])^(m + 1), x], x] + Int[(b*Sin[e + f*x])^m*(c^2 + d^2*Sin[e + f*x]^2), x] /; FreeQ[{b, c, d, e, f, m}, x]
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*sin[(e_.) + (f_.)*( x_)]^2), x_Symbol] :> Simp[(-C)*Cos[e + f*x]*((b*Sin[e + f*x])^(m + 1)/(b*f *(m + 2))), x] + Simp[(A*(m + 2) + C*(m + 1))/(m + 2) Int[(b*Sin[e + f*x] )^m, x], x] /; FreeQ[{b, e, f, A, C, m}, x] && !LtQ[m, -1]
Time = 1.60 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.88
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 a b \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )}{4}+\frac {3 f x}{8}+\frac {3 e}{8}\right )}{f}\) | \(89\) |
default | \(\frac {a^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )-\frac {2 a b \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3}+b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )}{4}+\frac {3 f x}{8}+\frac {3 e}{8}\right )}{f}\) | \(89\) |
parallelrisch | \(\frac {48 a^{2} f x +36 b^{2} f x +3 b^{2} \sin \left (4 f x +4 e \right )+16 a b \cos \left (3 f x +3 e \right )-24 \sin \left (2 f x +2 e \right ) a^{2}-24 \sin \left (2 f x +2 e \right ) b^{2}-144 \cos \left (f x +e \right ) a b -128 a b}{96 f}\) | \(90\) |
risch | \(\frac {a^{2} x}{2}+\frac {3 b^{2} x}{8}-\frac {3 a b \cos \left (f x +e \right )}{2 f}+\frac {b^{2} \sin \left (4 f x +4 e \right )}{32 f}+\frac {a b \cos \left (3 f x +3 e \right )}{6 f}-\frac {\sin \left (2 f x +2 e \right ) a^{2}}{4 f}-\frac {\sin \left (2 f x +2 e \right ) b^{2}}{4 f}\) | \(94\) |
parts | \(\frac {a^{2} \left (-\frac {\sin \left (f x +e \right ) \cos \left (f x +e \right )}{2}+\frac {f x}{2}+\frac {e}{2}\right )}{f}+\frac {b^{2} \left (-\frac {\left (\sin ^{3}\left (f x +e \right )+\frac {3 \sin \left (f x +e \right )}{2}\right ) \cos \left (f x +e \right )}{4}+\frac {3 f x}{8}+\frac {3 e}{8}\right )}{f}-\frac {2 a b \left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3 f}\) | \(94\) |
norman | \(\frac {\left (\frac {a^{2}}{2}+\frac {3 b^{2}}{8}\right ) x +\left (2 a^{2}+\frac {3 b^{2}}{2}\right ) x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (2 a^{2}+\frac {3 b^{2}}{2}\right ) x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (3 a^{2}+\frac {9 b^{2}}{4}\right ) x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+\left (\frac {a^{2}}{2}+\frac {3 b^{2}}{8}\right ) x \left (\tan ^{8}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {8 a b}{3 f}-\frac {\left (4 a^{2}+3 b^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{4 f}+\frac {\left (4 a^{2}+3 b^{2}\right ) \left (\tan ^{7}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {\left (4 a^{2}+11 b^{2}\right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}+\frac {\left (4 a^{2}+11 b^{2}\right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{4 f}-\frac {8 a b \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {32 a b \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{3 f}}{\left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{4}}\) | \(276\) |
1/f*(a^2*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-2/3*a*b*(2+sin(f*x+e)^ 2)*cos(f*x+e)+b^2*(-1/4*(sin(f*x+e)^3+3/2*sin(f*x+e))*cos(f*x+e)+3/8*f*x+3 /8*e))
Time = 0.29 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.83 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\frac {16 \, a b \cos \left (f x + e\right )^{3} + 3 \, {\left (4 \, a^{2} + 3 \, b^{2}\right )} f x - 48 \, a b \cos \left (f x + e\right ) + 3 \, {\left (2 \, b^{2} \cos \left (f x + e\right )^{3} - {\left (4 \, a^{2} + 5 \, b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{24 \, f} \]
1/24*(16*a*b*cos(f*x + e)^3 + 3*(4*a^2 + 3*b^2)*f*x - 48*a*b*cos(f*x + e) + 3*(2*b^2*cos(f*x + e)^3 - (4*a^2 + 5*b^2)*cos(f*x + e))*sin(f*x + e))/f
Leaf count of result is larger than twice the leaf count of optimal. 211 vs. \(2 (92) = 184\).
Time = 0.19 (sec) , antiderivative size = 211, normalized size of antiderivative = 2.09 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\begin {cases} \frac {a^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac {a^{2} x \cos ^{2}{\left (e + f x \right )}}{2} - \frac {a^{2} \sin {\left (e + f x \right )} \cos {\left (e + f x \right )}}{2 f} - \frac {2 a b \sin ^{2}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{f} - \frac {4 a b \cos ^{3}{\left (e + f x \right )}}{3 f} + \frac {3 b^{2} x \sin ^{4}{\left (e + f x \right )}}{8} + \frac {3 b^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{4} + \frac {3 b^{2} x \cos ^{4}{\left (e + f x \right )}}{8} - \frac {5 b^{2} \sin ^{3}{\left (e + f x \right )} \cos {\left (e + f x \right )}}{8 f} - \frac {3 b^{2} \sin {\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{8 f} & \text {for}\: f \neq 0 \\x \left (a + b \sin {\left (e \right )}\right )^{2} \sin ^{2}{\left (e \right )} & \text {otherwise} \end {cases} \]
Piecewise((a**2*x*sin(e + f*x)**2/2 + a**2*x*cos(e + f*x)**2/2 - a**2*sin( e + f*x)*cos(e + f*x)/(2*f) - 2*a*b*sin(e + f*x)**2*cos(e + f*x)/f - 4*a*b *cos(e + f*x)**3/(3*f) + 3*b**2*x*sin(e + f*x)**4/8 + 3*b**2*x*sin(e + f*x )**2*cos(e + f*x)**2/4 + 3*b**2*x*cos(e + f*x)**4/8 - 5*b**2*sin(e + f*x)* *3*cos(e + f*x)/(8*f) - 3*b**2*sin(e + f*x)*cos(e + f*x)**3/(8*f), Ne(f, 0 )), (x*(a + b*sin(e))**2*sin(e)**2, True))
Time = 0.20 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.83 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\frac {24 \, {\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a^{2} + 64 \, {\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} a b + 3 \, {\left (12 \, f x + 12 \, e + \sin \left (4 \, f x + 4 \, e\right ) - 8 \, \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2}}{96 \, f} \]
1/96*(24*(2*f*x + 2*e - sin(2*f*x + 2*e))*a^2 + 64*(cos(f*x + e)^3 - 3*cos (f*x + e))*a*b + 3*(12*f*x + 12*e + sin(4*f*x + 4*e) - 8*sin(2*f*x + 2*e)) *b^2)/f
Time = 0.28 (sec) , antiderivative size = 82, normalized size of antiderivative = 0.81 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\frac {1}{8} \, {\left (4 \, a^{2} + 3 \, b^{2}\right )} x + \frac {a b \cos \left (3 \, f x + 3 \, e\right )}{6 \, f} - \frac {3 \, a b \cos \left (f x + e\right )}{2 \, f} + \frac {b^{2} \sin \left (4 \, f x + 4 \, e\right )}{32 \, f} - \frac {{\left (a^{2} + b^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \]
1/8*(4*a^2 + 3*b^2)*x + 1/6*a*b*cos(3*f*x + 3*e)/f - 3/2*a*b*cos(f*x + e)/ f + 1/32*b^2*sin(4*f*x + 4*e)/f - 1/4*(a^2 + b^2)*sin(2*f*x + 2*e)/f
Time = 6.53 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.84 \[ \int \sin ^2(e+f x) (a+b \sin (e+f x))^2 \, dx=\frac {\frac {3\,b^2\,\sin \left (4\,e+4\,f\,x\right )}{4}-6\,b^2\,\sin \left (2\,e+2\,f\,x\right )-6\,a^2\,\sin \left (2\,e+2\,f\,x\right )-36\,a\,b\,\cos \left (e+f\,x\right )+4\,a\,b\,\cos \left (3\,e+3\,f\,x\right )+12\,a^2\,f\,x+9\,b^2\,f\,x}{24\,f} \]